setwd("~/Library/CloudStorage/OneDrive-UniversityofEdinburgh/4th year/dissertation/dissertation")
library(skimr) # summary
library(tidyverse)
library(lubridate) # dates management
library(gridExtra) # arrange plots
library(patchwork) # combine plots
2.2. Creates functions
theme_graphs_env_cond <- function(){
theme_classic() +
theme(axis.text.x = element_text(angle = 90))+
theme(axis.text = element_text(size = 11), # Adjust the size as needed
axis.title = element_text(size = 18),
legend.text = element_text(size=14))
}
data <- read.csv("Data_PAM_Scott_Base.csv") # load data
skimr::skim(data) # see a summary of the whole data
── Data Summary ────────────────────────
Values
Name data
Number of rows 26722
Number of columns 43
_______________________
Column type frequency:
character 9
numeric 34
________________________
Group variables None
str(data) # see the structure of each variable
'data.frame': 26722 obs. of 43 variables:
$ Datetime : chr "17/01/2019 04:17" "17/01/2019 05:17" "17/01/2019 06:17" "17/01/2019 07:17" ...
$ Time..abs.ms. : num 1.55e+12 1.55e+12 1.55e+12 1.55e+12 1.55e+12 ...
$ Time..rel.ms. : num 15441000 19041000 22641000 26241000 29841000 ...
$ JD.nz : num 17.7 17.7 17.8 17.8 17.8 ...
$ JD.running.nz : num 17.7 17.7 17.8 17.8 17.8 ...
$ Year.percent.nz : num 4.83 4.84 4.85 4.86 4.88 ...
$ Dec.Year.nz : num 19 19 19 19 19 ...
$ Date : chr "43482" "43482" "43482" "43482" ...
$ Time : chr "0.1787" "0.2204" "0.2620" "0.3037" ...
$ Julian.Day.UTC : num 17.2 17.2 17.3 17.3 17.3 ...
$ JD.running.UTC : num 17.2 17.2 17.3 17.3 17.3 ...
$ Year.percent.UTC: num 4.69 4.71 4.72 4.73 4.74 ...
$ UTC : num 19 19 19 19 19 ...
$ No. : int 1 2 3 4 5 6 7 8 9 10 ...
$ X1.F : int 106 120 127 119 79 118 93 90 107 96 ...
$ X1.Fm. : int 172 203 234 210 103 202 134 134 186 162 ...
$ X1.PAR : int 543 557 623 692 1335 352 689 815 376 569 ...
$ X1.Temp : num 2.3 1 -0.9 -0.9 -0.2 -1.7 -0.7 -0.2 -2.2 -0.7 ...
$ X1.Y..II. : num 0.384 0.409 0.457 0.433 0.233 0.416 0.306 0.328 0.425 0.407 ...
$ diff : int 66 83 107 91 24 84 41 44 79 66 ...
$ X : chr "0.384" "0.409" "0.457" "0.433" ...
$ X1.ETR : num 87.4 95.5 119.3 125.6 130.3 ...
$ X2.F : int 133 114 157 138 132 143 125 143 137 115 ...
$ X2.Fm. : int 179 163 268 217 200 235 202 266 256 213 ...
$ X2.PAR : int 994 971 712 534 774 330 460 316 257 358 ...
$ X2.Temp : num 2 2 1 -0.2 1.3 -0.7 -0.4 -1.2 -1.4 -1.2 ...
$ X2.Y..II. : num 0.257 0.301 0.414 0.364 0.34 0.391 0.381 0.462 0.465 0.46 ...
$ diff.1 : int 46 49 111 79 68 92 77 123 119 98 ...
$ X2.ETR : num 107 122.5 123.5 81.4 110.3 ...
$ X3.F : chr "51" "54" "47" "43" ...
$ X3.Fm. : chr "58" "57" "50" "51" ...
$ X3.PAR : chr "384" "381" "159" "257" ...
$ X3.Temp : chr "-1.2" "-1.9" "-3.9" "-3.9" ...
$ X3.Y..II. : num 0 0 0 0 0 0 0 0 0 0 ...
$ diff.2 : chr "7" "3" "3" "8" ...
$ X3.ETR : num 0 0 0 0 0 0 0 0 0 0 ...
$ X4.F : int 48 48 49 44 50 50 46 53 54 51 ...
$ X4.Fm. : int 70 67 69 64 63 77 68 86 85 81 ...
$ X4.PAR : int 532 787 842 444 1472 356 689 796 363 572 ...
$ X4.Temp : num 1.8 1.5 1.5 1 3 -1.4 -0.9 -1.2 -1.9 -0.7 ...
$ X4.Y..II. : num 0.314 0.284 0.29 0.313 0.206 0.351 0.324 0.384 0.365 0.37 ...
$ X4.ETR : num 70 93.7 102.3 58.2 127.1 ...
$ diff.3 : int 22 19 20 20 13 27 22 33 31 30 ...
tail(data) # view the last 6 rows of data
head(data) # view the first 6 rows of data
Data of sensors 1,2 and 4 are for the moss and 3 is for the lichen. Data is from Jan 2019 to Feb 2022. I am going to consider summer form 1 Nov to 15 Feb. I currently have data for 3 summers: 2019-2020, 2020-2021, 2021-2022.
4.1. Remove weird times and dates and divide the useful ones
data_clean <- data[, -c(2:13)] %>% # create a new data set without columns 2 to 13
mutate(Day_cum = as.numeric(data$Date)) # maintain cumulative date but change column name to more informative one and make it numeric
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `Day_cum = as.numeric(data$Date)`.
Caused by warning:
! NAs introduced by coercion
data_clean <- data_clean %>%
mutate(Date = parse_date_time(Datetime, 'dmy HM')) # indicate the format the date is wanted
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `Date = parse_date_time(Datetime, "dmy HM")`.
Caused by warning:
! 1 failed to parse.
print(data_clean[is.na(data_clean$Date), ]) # Check for rows with parsing issues\
# Row 584 is problematic
data_clean[584, 1]<-"10/02/2019 10:08" # Change the value to the correct one
data_clean <- data_clean %>%
mutate(Date = parse_date_time(Datetime, 'dmy HM')) # repeat with all the lines working
data_clean <- data_clean %>% # create new columns with month, year,
mutate(Month = month(Date), # day, minute
Year = year(Date),
Day = day(Date),
Hour = hour(Date),
Minute = minute(Date))
data_clean[584,] # check it worked
NA
4.2. Check the new data
str(data_clean)
skimr::skim(data_clean)
4.3. Change the diff columns names to match the rest of columns
data_clean<-data_clean %>%
rename(X1.diff = diff,
X2.diff = diff.1,
X3.diff = diff.2,
X4.diff = diff.3)
4.4. Need to change some variables of format
data_clean <- data_clean %>%
mutate(X1.PAR = as.numeric(X1.PAR), # Change PAR of X1, X2 and X3 to numeric
X2.PAR = as.numeric(X2.PAR),
X3.PAR = as.numeric(X3.PAR),
X4.PAR = as.numeric(X4.PAR),
X3.F = as.numeric(X3.F), # Change F and Fm to numeric
X3.Fm. = as.numeric(X3.Fm.),
X3.Temp = as.numeric(X3.Temp), # Change Temp 3 to numeric
X1.diff = as.numeric(X1.diff), # Change all diff to numeric
X2.diff = as.numeric(X2.diff),
X3.diff = as.numeric(X3.diff),
X4.diff = as.numeric(X4.diff))
#Month = as.factor(Month), # Change day, month and year to categories -> is it a great idea?
#Year = as.factor(Year),
#Day = as.factor(Day))
4.5. Create column for month (in letters) and day-month
data_clean <- data_clean %>%
mutate(Month_Name = as.factor(case_when( # Make a column with the names of the months and make them a factor
Month == 1 ~ "Jan", # case_when from dplyr package
Month == 2 ~ "Feb",
Month == 3 ~ "Mar",
Month == 4 ~ "Apr",
Month == 5 ~ "May",
Month == 6 ~ "Jun",
Month == 7 ~ "Jul",
Month == 8 ~ "Aug",
Month == 9 ~ "Sep",
Month == 10 ~ "Oct",
Month == 11 ~ "Nov",
Month == 12 ~ "Dec"))) %>%
mutate(Date_Combined = as.factor( # Make a column with the day and month name separated by -
paste(Month_Name, Day, sep = "-"))) # Make the column a factor
4.6. Fix Day_cum
print(data_clean[is.na(data_clean$Day_cum), ]) # Check for rows with NAs in Day_cum
# From 25/01/2022 the date format changes and it is not cummulative anymore
data_clean <- data_clean %>%
mutate(Date_no_time = paste(year(Date), month(Date), day(Date), sep = "-")) %>% # Create acolumn with the date but without the time
mutate(Day_cum = if_else(No. >= 26510, 44586 + as.numeric(difftime(Date_no_time, as.Date("2022-01-25"), units = "days")), Day_cum)) %>% # Fix the format of Day_cum after the 25/01/2022
# Difftime weeks the time passed between 2 days in the units indicated
select(-Date_no_time) # Remove Date_no_time from the data set
print(data_clean[is.na(data_clean$Day_cum), ]) # Check for rows with NAs in Day_cum
head(data_clean$Date_Combined) # Check it worked
[1] Jan-17 Jan-17 Jan-17 Jan-17 Jan-17 Jan-17
366 Levels: Apr-1 Apr-10 Apr-11 Apr-12 Apr-13 Apr-14 Apr-15 Apr-16 Apr-17 Apr-18 Apr-19 Apr-2 ... Sep-9
tail(data_clean$Date_Combined)
[1] Feb-3 Feb-3 Feb-3 Feb-3 Feb-3 Feb-3
366 Levels: Apr-1 Apr-10 Apr-11 Apr-12 Apr-13 Apr-14 Apr-15 Apr-16 Apr-17 Apr-18 Apr-19 Apr-2 ... Sep-9
4.7. Create a column for average moss values of yield,PAR, F, Fm, Temp, ETR and diff
data_clean <- data_clean %>%
mutate(av_moss_yield = rowMeans(data_clean[, c("X1.Y..II.", "X2.Y..II.", "X4.Y..II.")]), # rowMeans gets the mean of each row in the data frame and stores the result in a new column
av_moss_PAR = rowMeans(data_clean[, c("X1.PAR", "X2.PAR", "X4.PAR")]),
av_moss_F = rowMeans(data_clean[, c("X1.F", "X2.F", "X4.F")]),
av_moss_Fm = rowMeans(data_clean[, c("X1.Fm.", "X2.Fm.", "X4.Fm.")]),
av_moss_temp = rowMeans(data_clean[, c("X1.Temp", "X2.Temp", "X4.Temp")]),
av_moss_ETR = rowMeans(data_clean[, c("X1.ETR", "X2.ETR", "X4.ETR")]),
av_moss_diff = rowMeans(data_clean[, c("X1.diff", "X2.diff", "X4.diff")]))
Summer 2019-2020
This includes the data from the 1-Nov 2019 to the 15 of Feb 2020
summer_19_20 <- data_clean %>%
filter(Year == 2019 & Month %in% c(11,12) | # Filter all data points in Nov, Dec 2019 and Jan, Feb 2020
Year == 2020 & Month %in% c(1,2)) %>%
filter(!(Month == 2 & Day > 15)) # remove days over the 15th of Feb
# Check our data
head(summer_19_20) # First 6 rows
tail(summer_19_20) # Last 6 rows
summer_19_20$Date_Combined <- reorder(summer_19_20$Date_Combined, summer_19_20$Day_cum) # reorder the factors of Date_Combined according to the values of Day_cum. Do it for each subset individually because factors repeat for each year
levels(summer_19_20$Date_Combined)
[1] "Nov-1" "Nov-2" "Nov-3" "Nov-4" "Nov-5" "Nov-6" "Nov-7" "Nov-8" "Nov-9" "Nov-10" "Nov-11"
[12] "Nov-12" "Nov-13" "Nov-14" "Nov-15" "Nov-16" "Nov-17" "Nov-18" "Nov-19" "Nov-20" "Nov-21" "Nov-22"
[23] "Nov-23" "Nov-24" "Nov-25" "Nov-26" "Nov-27" "Nov-28" "Nov-29" "Nov-30" "Dec-1" "Dec-2" "Dec-3"
[34] "Dec-4" "Dec-5" "Dec-6" "Dec-7" "Dec-8" "Dec-9" "Dec-10" "Dec-11" "Dec-12" "Dec-13" "Dec-14"
[45] "Dec-15" "Dec-16" "Dec-17" "Dec-18" "Dec-19" "Dec-20" "Dec-21" "Dec-22" "Dec-23" "Dec-24" "Dec-25"
[56] "Dec-26" "Dec-27" "Dec-28" "Dec-29" "Dec-30" "Dec-31" "Jan-1" "Jan-2" "Jan-3" "Jan-4" "Jan-5"
[67] "Jan-6" "Jan-7" "Jan-8" "Jan-9" "Jan-10" "Jan-11" "Jan-12" "Jan-13" "Jan-14" "Jan-15" "Jan-16"
[78] "Jan-17" "Jan-18" "Jan-19" "Jan-20" "Jan-21" "Jan-22" "Jan-23" "Jan-24" "Jan-25" "Jan-26" "Jan-27"
[89] "Jan-28" "Jan-29" "Jan-30" "Jan-31" "Feb-1" "Feb-2" "Feb-3" "Feb-4" "Feb-5" "Feb-6" "Feb-7"
[100] "Feb-8" "Feb-9" "Feb-10" "Feb-11" "Feb-12" "Feb-13" "Feb-14" "Feb-15" "Apr-1" "Apr-10" "Apr-11"
[111] "Apr-12" "Apr-13" "Apr-14" "Apr-15" "Apr-16" "Apr-17" "Apr-18" "Apr-19" "Apr-2" "Apr-20" "Apr-21"
[122] "Apr-22" "Apr-23" "Apr-24" "Apr-25" "Apr-26" "Apr-27" "Apr-28" "Apr-29" "Apr-3" "Apr-30" "Apr-4"
[133] "Apr-5" "Apr-6" "Apr-7" "Apr-8" "Apr-9" "Aug-1" "Aug-10" "Aug-11" "Aug-12" "Aug-13" "Aug-14"
[144] "Aug-15" "Aug-16" "Aug-17" "Aug-18" "Aug-19" "Aug-2" "Aug-20" "Aug-21" "Aug-22" "Aug-23" "Aug-24"
[155] "Aug-25" "Aug-26" "Aug-27" "Aug-28" "Aug-29" "Aug-3" "Aug-30" "Aug-31" "Aug-4" "Aug-5" "Aug-6"
[166] "Aug-7" "Aug-8" "Aug-9" "Feb-16" "Feb-17" "Feb-18" "Feb-19" "Feb-20" "Feb-21" "Feb-22" "Feb-23"
[177] "Feb-24" "Feb-25" "Feb-26" "Feb-27" "Feb-28" "Feb-29" "Jul-1" "Jul-10" "Jul-11" "Jul-12" "Jul-13"
[188] "Jul-14" "Jul-15" "Jul-16" "Jul-17" "Jul-18" "Jul-19" "Jul-2" "Jul-20" "Jul-21" "Jul-22" "Jul-23"
[199] "Jul-24" "Jul-25" "Jul-26" "Jul-27" "Jul-28" "Jul-29" "Jul-3" "Jul-30" "Jul-31" "Jul-4" "Jul-5"
[210] "Jul-6" "Jul-7" "Jul-8" "Jul-9" "Jun-1" "Jun-10" "Jun-11" "Jun-12" "Jun-13" "Jun-14" "Jun-15"
[221] "Jun-16" "Jun-17" "Jun-18" "Jun-19" "Jun-2" "Jun-20" "Jun-21" "Jun-22" "Jun-23" "Jun-24" "Jun-25"
[232] "Jun-26" "Jun-27" "Jun-28" "Jun-29" "Jun-3" "Jun-30" "Jun-4" "Jun-5" "Jun-6" "Jun-7" "Jun-8"
[243] "Jun-9" "Mar-1" "Mar-10" "Mar-11" "Mar-12" "Mar-13" "Mar-14" "Mar-15" "Mar-16" "Mar-17" "Mar-18"
[254] "Mar-19" "Mar-2" "Mar-20" "Mar-21" "Mar-22" "Mar-23" "Mar-24" "Mar-25" "Mar-26" "Mar-27" "Mar-28"
[265] "Mar-29" "Mar-3" "Mar-30" "Mar-31" "Mar-4" "Mar-5" "Mar-6" "Mar-7" "Mar-8" "Mar-9" "May-1"
[276] "May-10" "May-11" "May-12" "May-13" "May-14" "May-15" "May-16" "May-17" "May-18" "May-19" "May-2"
[287] "May-20" "May-21" "May-22" "May-23" "May-24" "May-25" "May-26" "May-27" "May-28" "May-29" "May-3"
[298] "May-30" "May-31" "May-4" "May-5" "May-6" "May-7" "May-8" "May-9" "Oct-1" "Oct-10" "Oct-11"
[309] "Oct-12" "Oct-13" "Oct-14" "Oct-15" "Oct-16" "Oct-17" "Oct-18" "Oct-19" "Oct-2" "Oct-20" "Oct-21"
[320] "Oct-22" "Oct-23" "Oct-24" "Oct-25" "Oct-26" "Oct-27" "Oct-28" "Oct-29" "Oct-3" "Oct-30" "Oct-31"
[331] "Oct-4" "Oct-5" "Oct-6" "Oct-7" "Oct-8" "Oct-9" "Sep-1" "Sep-10" "Sep-11" "Sep-12" "Sep-13"
[342] "Sep-14" "Sep-15" "Sep-16" "Sep-17" "Sep-18" "Sep-19" "Sep-2" "Sep-20" "Sep-21" "Sep-22" "Sep-23"
[353] "Sep-24" "Sep-25" "Sep-26" "Sep-27" "Sep-28" "Sep-29" "Sep-3" "Sep-30" "Sep-4" "Sep-5" "Sep-6"
[364] "Sep-7" "Sep-8" "Sep-9"
Summer 2020-2021
This includes the data from the 1-Nov 2020 to the 15 of Feb 2021
summer_20_21 <- data_clean %>%
filter(Year == 2020 & Month %in% c(11,12) | # Filter all data points in Nov, Dec 2029 and Jan, Feb 2021
Year == 2021 & Month %in% c(1,2)) %>%
filter(!(Month == 2 & Day > 15)) # remove days over the 15th of Feb
# Check our data
head(summer_20_21) # First 6 rows
tail(summer_20_21) # Last 6 rows
summer_20_21$Date_Combined <- reorder(summer_20_21$Date_Combined, summer_20_21$Day_cum) # reorder the factors of Date_Combined according to the values of Day_cum. Do it for each subset individually because factors repeat for each year
levels(summer_20_21$Date_Combined)
[1] "Nov-1" "Nov-2" "Nov-3" "Nov-4" "Nov-5" "Nov-6" "Nov-7" "Nov-8" "Nov-9" "Nov-10" "Nov-11"
[12] "Nov-12" "Nov-13" "Nov-14" "Nov-15" "Nov-16" "Nov-17" "Nov-18" "Nov-19" "Nov-20" "Nov-21" "Nov-22"
[23] "Nov-23" "Nov-24" "Nov-25" "Nov-26" "Nov-27" "Nov-28" "Nov-29" "Nov-30" "Dec-1" "Dec-2" "Dec-3"
[34] "Dec-4" "Dec-5" "Dec-6" "Dec-7" "Dec-8" "Dec-9" "Dec-10" "Dec-11" "Dec-12" "Dec-13" "Dec-14"
[45] "Dec-15" "Dec-16" "Dec-17" "Dec-18" "Dec-19" "Dec-20" "Dec-21" "Dec-22" "Dec-23" "Dec-24" "Dec-25"
[56] "Dec-26" "Dec-27" "Dec-28" "Dec-29" "Dec-30" "Dec-31" "Jan-1" "Jan-2" "Jan-3" "Jan-4" "Jan-5"
[67] "Jan-6" "Jan-7" "Jan-8" "Jan-9" "Jan-10" "Jan-11" "Jan-12" "Jan-13" "Jan-14" "Jan-15" "Jan-16"
[78] "Jan-17" "Jan-18" "Jan-19" "Jan-20" "Jan-21" "Jan-22" "Jan-23" "Jan-24" "Jan-25" "Jan-26" "Jan-27"
[89] "Jan-28" "Jan-29" "Jan-30" "Jan-31" "Feb-1" "Feb-2" "Feb-3" "Feb-4" "Feb-5" "Feb-6" "Feb-7"
[100] "Feb-8" "Feb-9" "Feb-10" "Feb-11" "Feb-12" "Feb-13" "Feb-14" "Feb-15" "Apr-1" "Apr-10" "Apr-11"
[111] "Apr-12" "Apr-13" "Apr-14" "Apr-15" "Apr-16" "Apr-17" "Apr-18" "Apr-19" "Apr-2" "Apr-20" "Apr-21"
[122] "Apr-22" "Apr-23" "Apr-24" "Apr-25" "Apr-26" "Apr-27" "Apr-28" "Apr-29" "Apr-3" "Apr-30" "Apr-4"
[133] "Apr-5" "Apr-6" "Apr-7" "Apr-8" "Apr-9" "Aug-1" "Aug-10" "Aug-11" "Aug-12" "Aug-13" "Aug-14"
[144] "Aug-15" "Aug-16" "Aug-17" "Aug-18" "Aug-19" "Aug-2" "Aug-20" "Aug-21" "Aug-22" "Aug-23" "Aug-24"
[155] "Aug-25" "Aug-26" "Aug-27" "Aug-28" "Aug-29" "Aug-3" "Aug-30" "Aug-31" "Aug-4" "Aug-5" "Aug-6"
[166] "Aug-7" "Aug-8" "Aug-9" "Feb-16" "Feb-17" "Feb-18" "Feb-19" "Feb-20" "Feb-21" "Feb-22" "Feb-23"
[177] "Feb-24" "Feb-25" "Feb-26" "Feb-27" "Feb-28" "Feb-29" "Jul-1" "Jul-10" "Jul-11" "Jul-12" "Jul-13"
[188] "Jul-14" "Jul-15" "Jul-16" "Jul-17" "Jul-18" "Jul-19" "Jul-2" "Jul-20" "Jul-21" "Jul-22" "Jul-23"
[199] "Jul-24" "Jul-25" "Jul-26" "Jul-27" "Jul-28" "Jul-29" "Jul-3" "Jul-30" "Jul-31" "Jul-4" "Jul-5"
[210] "Jul-6" "Jul-7" "Jul-8" "Jul-9" "Jun-1" "Jun-10" "Jun-11" "Jun-12" "Jun-13" "Jun-14" "Jun-15"
[221] "Jun-16" "Jun-17" "Jun-18" "Jun-19" "Jun-2" "Jun-20" "Jun-21" "Jun-22" "Jun-23" "Jun-24" "Jun-25"
[232] "Jun-26" "Jun-27" "Jun-28" "Jun-29" "Jun-3" "Jun-30" "Jun-4" "Jun-5" "Jun-6" "Jun-7" "Jun-8"
[243] "Jun-9" "Mar-1" "Mar-10" "Mar-11" "Mar-12" "Mar-13" "Mar-14" "Mar-15" "Mar-16" "Mar-17" "Mar-18"
[254] "Mar-19" "Mar-2" "Mar-20" "Mar-21" "Mar-22" "Mar-23" "Mar-24" "Mar-25" "Mar-26" "Mar-27" "Mar-28"
[265] "Mar-29" "Mar-3" "Mar-30" "Mar-31" "Mar-4" "Mar-5" "Mar-6" "Mar-7" "Mar-8" "Mar-9" "May-1"
[276] "May-10" "May-11" "May-12" "May-13" "May-14" "May-15" "May-16" "May-17" "May-18" "May-19" "May-2"
[287] "May-20" "May-21" "May-22" "May-23" "May-24" "May-25" "May-26" "May-27" "May-28" "May-29" "May-3"
[298] "May-30" "May-31" "May-4" "May-5" "May-6" "May-7" "May-8" "May-9" "Oct-1" "Oct-10" "Oct-11"
[309] "Oct-12" "Oct-13" "Oct-14" "Oct-15" "Oct-16" "Oct-17" "Oct-18" "Oct-19" "Oct-2" "Oct-20" "Oct-21"
[320] "Oct-22" "Oct-23" "Oct-24" "Oct-25" "Oct-26" "Oct-27" "Oct-28" "Oct-29" "Oct-3" "Oct-30" "Oct-31"
[331] "Oct-4" "Oct-5" "Oct-6" "Oct-7" "Oct-8" "Oct-9" "Sep-1" "Sep-10" "Sep-11" "Sep-12" "Sep-13"
[342] "Sep-14" "Sep-15" "Sep-16" "Sep-17" "Sep-18" "Sep-19" "Sep-2" "Sep-20" "Sep-21" "Sep-22" "Sep-23"
[353] "Sep-24" "Sep-25" "Sep-26" "Sep-27" "Sep-28" "Sep-29" "Sep-3" "Sep-30" "Sep-4" "Sep-5" "Sep-6"
[364] "Sep-7" "Sep-8" "Sep-9"
Summer 2021-2022
This includes the data from the 1-Nov 2021 to the 15 of Feb 2022.
* I only have the data until the 3rd of Feb yet
summer_21_22 <- data_clean %>%
filter(Year == 2021 & Month %in% c(11,12) | # Filter all data points in Nov, Dec 2021 and Jan, Feb 2022
Year == 2022 & Month %in% c(1,2)) %>%
filter(!(Month == 2 & Day > 15)) # remove days over the 15th of Feb
# Check our data
head(summer_21_22) # First 6 rows
tail(summer_21_22) # Last 6 rows
summer_21_22$Date_Combined <- reorder(summer_21_22$Date_Combined, summer_21_22$Day_cum) # reorder the factors of Date_Combined according to the values of Day_cum. Do it for each subset individually because factors repeat for each year
levels(summer_21_22$Date_Combined)
[1] "Nov-1" "Nov-2" "Nov-3" "Nov-4" "Nov-5" "Nov-6" "Nov-7" "Nov-8" "Nov-9" "Nov-10" "Nov-11"
[12] "Nov-12" "Nov-13" "Nov-14" "Nov-15" "Nov-16" "Nov-17" "Nov-18" "Nov-19" "Nov-20" "Nov-21" "Nov-22"
[23] "Nov-23" "Nov-24" "Nov-25" "Nov-26" "Nov-27" "Nov-28" "Nov-29" "Nov-30" "Dec-1" "Dec-2" "Dec-3"
[34] "Dec-4" "Dec-5" "Dec-6" "Dec-7" "Dec-8" "Dec-9" "Dec-10" "Dec-11" "Dec-12" "Dec-13" "Dec-14"
[45] "Dec-15" "Dec-16" "Dec-17" "Dec-18" "Dec-19" "Dec-20" "Dec-21" "Dec-22" "Dec-23" "Dec-24" "Dec-25"
[56] "Dec-26" "Dec-27" "Dec-28" "Dec-29" "Dec-30" "Dec-31" "Jan-1" "Jan-2" "Jan-3" "Jan-4" "Jan-5"
[67] "Jan-6" "Jan-7" "Jan-8" "Jan-9" "Jan-10" "Jan-11" "Jan-12" "Jan-13" "Jan-14" "Jan-15" "Jan-16"
[78] "Jan-17" "Jan-18" "Jan-19" "Jan-20" "Jan-21" "Jan-22" "Jan-23" "Jan-24" "Jan-25" "Jan-26" "Jan-27"
[89] "Jan-28" "Jan-29" "Jan-30" "Jan-31" "Feb-1" "Feb-2" "Feb-3" "Apr-1" "Apr-10" "Apr-11" "Apr-12"
[100] "Apr-13" "Apr-14" "Apr-15" "Apr-16" "Apr-17" "Apr-18" "Apr-19" "Apr-2" "Apr-20" "Apr-21" "Apr-22"
[111] "Apr-23" "Apr-24" "Apr-25" "Apr-26" "Apr-27" "Apr-28" "Apr-29" "Apr-3" "Apr-30" "Apr-4" "Apr-5"
[122] "Apr-6" "Apr-7" "Apr-8" "Apr-9" "Aug-1" "Aug-10" "Aug-11" "Aug-12" "Aug-13" "Aug-14" "Aug-15"
[133] "Aug-16" "Aug-17" "Aug-18" "Aug-19" "Aug-2" "Aug-20" "Aug-21" "Aug-22" "Aug-23" "Aug-24" "Aug-25"
[144] "Aug-26" "Aug-27" "Aug-28" "Aug-29" "Aug-3" "Aug-30" "Aug-31" "Aug-4" "Aug-5" "Aug-6" "Aug-7"
[155] "Aug-8" "Aug-9" "Feb-10" "Feb-11" "Feb-12" "Feb-13" "Feb-14" "Feb-15" "Feb-16" "Feb-17" "Feb-18"
[166] "Feb-19" "Feb-20" "Feb-21" "Feb-22" "Feb-23" "Feb-24" "Feb-25" "Feb-26" "Feb-27" "Feb-28" "Feb-29"
[177] "Feb-4" "Feb-5" "Feb-6" "Feb-7" "Feb-8" "Feb-9" "Jul-1" "Jul-10" "Jul-11" "Jul-12" "Jul-13"
[188] "Jul-14" "Jul-15" "Jul-16" "Jul-17" "Jul-18" "Jul-19" "Jul-2" "Jul-20" "Jul-21" "Jul-22" "Jul-23"
[199] "Jul-24" "Jul-25" "Jul-26" "Jul-27" "Jul-28" "Jul-29" "Jul-3" "Jul-30" "Jul-31" "Jul-4" "Jul-5"
[210] "Jul-6" "Jul-7" "Jul-8" "Jul-9" "Jun-1" "Jun-10" "Jun-11" "Jun-12" "Jun-13" "Jun-14" "Jun-15"
[221] "Jun-16" "Jun-17" "Jun-18" "Jun-19" "Jun-2" "Jun-20" "Jun-21" "Jun-22" "Jun-23" "Jun-24" "Jun-25"
[232] "Jun-26" "Jun-27" "Jun-28" "Jun-29" "Jun-3" "Jun-30" "Jun-4" "Jun-5" "Jun-6" "Jun-7" "Jun-8"
[243] "Jun-9" "Mar-1" "Mar-10" "Mar-11" "Mar-12" "Mar-13" "Mar-14" "Mar-15" "Mar-16" "Mar-17" "Mar-18"
[254] "Mar-19" "Mar-2" "Mar-20" "Mar-21" "Mar-22" "Mar-23" "Mar-24" "Mar-25" "Mar-26" "Mar-27" "Mar-28"
[265] "Mar-29" "Mar-3" "Mar-30" "Mar-31" "Mar-4" "Mar-5" "Mar-6" "Mar-7" "Mar-8" "Mar-9" "May-1"
[276] "May-10" "May-11" "May-12" "May-13" "May-14" "May-15" "May-16" "May-17" "May-18" "May-19" "May-2"
[287] "May-20" "May-21" "May-22" "May-23" "May-24" "May-25" "May-26" "May-27" "May-28" "May-29" "May-3"
[298] "May-30" "May-31" "May-4" "May-5" "May-6" "May-7" "May-8" "May-9" "Oct-1" "Oct-10" "Oct-11"
[309] "Oct-12" "Oct-13" "Oct-14" "Oct-15" "Oct-16" "Oct-17" "Oct-18" "Oct-19" "Oct-2" "Oct-20" "Oct-21"
[320] "Oct-22" "Oct-23" "Oct-24" "Oct-25" "Oct-26" "Oct-27" "Oct-28" "Oct-29" "Oct-3" "Oct-30" "Oct-31"
[331] "Oct-4" "Oct-5" "Oct-6" "Oct-7" "Oct-8" "Oct-9" "Sep-1" "Sep-10" "Sep-11" "Sep-12" "Sep-13"
[342] "Sep-14" "Sep-15" "Sep-16" "Sep-17" "Sep-18" "Sep-19" "Sep-2" "Sep-20" "Sep-21" "Sep-22" "Sep-23"
[353] "Sep-24" "Sep-25" "Sep-26" "Sep-27" "Sep-28" "Sep-29" "Sep-3" "Sep-30" "Sep-4" "Sep-5" "Sep-6"
[364] "Sep-7" "Sep-8" "Sep-9"
Sample X1 (moss)
(temp_plot_19_20_X1 <- summer_19_20 %>%
ggplot(aes(Date_Combined, X1.Temp)) +
geom_point()+ # Add points for the data
geom_line()+ # Add a line that joins the points
geom_hline(yintercept = 0, color = "blue", linetype = "dashed") +
labs(x = "\nDate (day)", y = "Temperature \nMoss X1 (°C)") +
theme_graphs_env_cond() +
theme(axis.text.x = element_blank(),
axis.title.x = element_blank())) # Remove axis label and text for the graph
(PAR_plot_19_20_X1 <-summer_19_20 %>%
ggplot(aes(Date_Combined, X1.PAR)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
labs(x = "\nDate (day)", y = "PAR \n(µmol m-2 s^-1)") +
theme_graphs_env_cond())
(combined_plot_19_20_X1 <- (temp_plot_19_20_X1/PAR_plot_19_20_X1) & plot_layout(ncol = 1))
Sample X2 (moss)
(temp_plot_19_20_X2 <- summer_19_20 %>%
ggplot(aes(Date_Combined, X2.Temp)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
geom_hline(yintercept = 0, color = "blue", linetype = "dashed") +
labs(x = "\nDate (day)", y = "Temperature \nMoss X2 (°C)") +
theme_graphs_env_cond()+
theme(axis.text.x = element_blank(),
axis.title.x = element_blank()))
(PAR_plot_19_20_X2 <-summer_19_20 %>%
ggplot(aes(Date_Combined, X2.PAR)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
labs(x = "\nDate (day)", y = "PAR \n(µmol m-2 s^-1)") +
theme_graphs_env_cond())
(combined_plot_19_20_X2 <- (temp_plot_19_20_X2/PAR_plot_19_20_X2) & plot_layout(ncol = 1))
Sample X3 (Lichen)
(temp_plot_19_20_X3 <- summer_19_20 %>%
ggplot(aes(Date_Combined, X3.Temp)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
geom_hline(yintercept = 0, color = "blue", linetype = "dashed") +
labs(x = "\nDate (day)", y = "Temperature \nLichen X3 (°C)") +
theme_graphs_env_cond()+
theme(axis.text.x = element_blank(),
axis.title.x = element_blank()))
(PAR_plot_19_20_X3 <-summer_19_20 %>%
ggplot(aes(Date_Combined, X3.PAR)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
labs(x = "\nDate (day)", y = "PAR \n(µmol m-2 s^-1)") +
theme_graphs_env_cond())
(combined_plot_19_20_X3 <- (temp_plot_19_20_X3/PAR_plot_19_20_X3) & plot_layout(ncol = 1))
Sample X4 (Moss)
(temp_plot_19_20_X4 <- summer_19_20 %>%
ggplot(aes(Date_Combined, X4.Temp)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
geom_hline(yintercept = 0, color = "blue", linetype = "dashed") +
labs(x = "\nDate (day)", y = "Temperature \nMoss X4 (°C)") +
theme_graphs_env_cond()+
theme(axis.text.x = element_blank(),
axis.title.x = element_blank()))
(PAR_plot_19_20_X4 <-summer_19_20 %>%
ggplot(aes(Date_Combined, X4.PAR)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
labs(x = "\nDate (day)", y = "PAR \n(µmol m-2 s^-1)") +
theme_graphs_env_cond())
(combined_plot_19_20_X4 <- (temp_plot_19_20_X4/PAR_plot_19_20_X4) & plot_layout(ncol = 1))
NA
NA
Sample X1 (Moss)
(temp_plot_20_21_X1 <- summer_20_21 %>%
ggplot(aes(Date_Combined, X1.Temp)) +
geom_point()+ # Add points for the data
geom_line()+ # Add a line that joins the points
geom_hline(yintercept = 0, color = "blue", linetype = "dashed") +
labs(x = "\nDate (day)", y = "Temperature \nMoss X1 (°C)") +
theme_graphs_env_cond() +
theme(axis.text.x = element_blank(),
axis.title.x = element_blank())) # Remove axis label and text for the graph
(PAR_plot_20_21_X1 <-summer_20_21 %>%
ggplot(aes(Date_Combined, X1.PAR)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
labs(x = "\nDate (day)", y = "PAR \n(µmol m-2 s^-1)") +
theme_graphs_env_cond())
(combined_plot_20_21_X1 <- (temp_plot_20_21_X1/PAR_plot_20_21_X1) & plot_layout(ncol = 1))
Sample X2 (Moss)
(temp_plot_20_21_X2 <- summer_20_21 %>%
ggplot(aes(Date_Combined, X2.Temp)) +
geom_point()+ # Add points for the data
geom_line()+ # Add a line that joins the points
geom_hline(yintercept = 0, color = "blue", linetype = "dashed") +
labs(x = "\nDate (day)", y = "Temperature \nMoss X1 (°C)") +
theme_graphs_env_cond() +
theme(axis.text.x = element_blank(),
axis.title.x = element_blank())) # Remove axis label and text for the graph
(PAR_plot_20_21_X2 <-summer_20_21 %>%
ggplot(aes(Date_Combined, X2.PAR)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
labs(x = "\nDate (day)", y = "PAR \n(µmol m-2 s^-1)") +
theme_graphs_env_cond())
(combined_plot_20_21_X2 <- (temp_plot_20_21_X2/PAR_plot_20_21_X2) & plot_layout(ncol = 1))
Saple X3 (Lichen)
(temp_plot_20_21_X3 <- summer_20_21 %>%
ggplot(aes(Date_Combined, X3.Temp)) +
geom_point()+ # Add points for the data
geom_line()+ # Add a line that joins the points
geom_hline(yintercept = 0, color = "blue", linetype = "dashed") +
labs(x = "\nDate (day)", y = "Temperature \nMoss X1 (°C)") +
theme_graphs_env_cond() +
theme(axis.text.x = element_blank(),
axis.title.x = element_blank())) # Remove axis label and text for the graph
(PAR_plot_20_21_X3 <-summer_20_21 %>%
ggplot(aes(Date_Combined, X3.PAR)) +
geom_point()+ # Add points for the data
geom_line()+ # add a line that joins the points
labs(x = "\nDate (day)", y = "PAR \n(µmol m-2 s^-1)") +
theme_graphs_env_cond())
(combined_plot_20_21_X3 <- (temp_plot_20_21_X3/PAR_plot_20_21_X3) & plot_layout(ncol = 1))